<?php
  include "ReaderXML.class.php";
  include "RenderMapXML.class.php";

  $path = $_SERVER['PATH_INFO'];

  if($path != null){

    $path_param = spliti("/", $path);

    switch($path_param[1]) {
      case "layer" : $layer = new RenderLayerXML();
                     $layer->genFloodLayerXML();
                     break;
      case "map" :
                     if($path_param[2] == 1){
                        $xml = "http://maps.google.com/maps/ms?ie=UTF8&hl=en&source=embed&msa=0&output=georss&msid=109261647619174335009.000492e56b7863b0ebfb7";
                     }else if($path_param[2] == 2){
                        $xml = "http://maps.google.com/maps/ms?hl=en&ie=UTF8&source=embed&msa=0&output=georss&msid=108663478994178951894.000493099c3cea1c38143";
                     }else if($path_param[2] == 3){
                        $xml = "http://maps.google.co.th/maps/ms?hl=en&ie=UTF8&msa=0&output=georss&msid=108663478994178951894.0004931805b4cbfbf5000";
                     }
                      $result = array();
                     $rssGMap = new ReaderXML($xml);
                     $result = $rssGMap->getReadXML();
                      //var_dump($result);
                     $map = new RenderMapXML();
                     $map->genFloodMapXML($result);
                     break;
      default :
        break;
    }
  }else{
                    $xml = "data-hotel.xml";
                         $rssGMap = new ReaderXML($xml);
                     $result = $rssGMap->getReadHotelXML();
                      //var_dump($result);
                     //$map = new RenderMapXML();
                     //$map->genFloodMapXML($result);
  }
?>